package lily.phs.vaccination;
import lily.phs.child.ChildScrollActivity;
import lily.phs.object.HereTipa;
import lily.phs.object.VaccinationCard;
import lily.phs.object.VaccinationRecord;
import lily.phs.urh.R;
import lily.phs.vaccination.VaccinationCardView.MyView;
import lily.ui.control.MyPopupWindow;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.text.InputType;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;

public class VaccinationRecordView extends RelativeLayout implements OnClickListener,OnFocusChangeListener{
	private EditText et_vare_name,et_vare_profile_id,
					vare_hepatitis_b_vaccine1_date,vare_hepatitis_b_vaccine1_position,vare_hepatitis_b_vaccine1_batch_num,
					vare_hepatitis_b_vaccine1_doctor,vare_hepatitis_b_vaccine1_remark,
					vare_hepatitis_b_vaccine2_date,vare_hepatitis_b_vaccine2_position,vare_hepatitis_b_vaccine2_batch_num,
					vare_hepatitis_b_vaccine2_doctor,vare_hepatitis_b_vaccine2_remark,
					vare_hepatitis_b_vaccine3_date,vare_hepatitis_b_vaccine3_position,vare_hepatitis_b_vaccine3_batch_num,
					vare_hepatitis_b_vaccine3_doctor,vare_hepatitis_b_vaccine3_remark,
					vare_BCG_vaccine_date,vare_BCG_vaccine_position,vare_BCG_vaccine_batch_num,vare_BCG_vaccine_doctor,vare_BCG_vaccine_remark,
					vare_poliomyelitis_vaccine1_date,vare_poliomyelitis_vaccine1_position,vare_poliomyelitis_vaccine1_batch_num,
					vare_poliomyelitis_vaccine1_doctor,vare_poliomyelitis_vaccine1_remark,
					vare_poliomyelitis_vaccine2_date,vare_poliomyelitis_vaccine2_position,vare_poliomyelitis_vaccine2_batch_num,
					vare_poliomyelitis_vaccine2_doctor,vare_poliomyelitis_vaccine2_remark,
					vare_poliomyelitis_vaccine3_date,vare_poliomyelitis_vaccine3_position,vare_poliomyelitis_vaccine3_batch_num,
					vare_poliomyelitis_vaccine3_doctor,vare_poliomyelitis_vaccine3_remark,
					vare_poliomyelitis_vaccine4_date,vare_poliomyelitis_vaccine4_position,vare_poliomyelitis_vaccine4_batch_num,
					vare_poliomyelitis_vaccine4_doctor,vare_poliomyelitis_vaccine4_remark,
					vare_DPT1_date,vare_DPT1_position,vare_DPT1_batch_num,vare_DPT1_doctor,vare_DPT1_remark,
					vare_DPT2_date,vare_DPT2_position,vare_DPT2_batch_num,vare_DPT2_doctor,vare_DPT2_remark,
					vare_DPT3_date,vare_DPT3_position,vare_DPT3_batch_num,vare_DPT3_doctor,vare_DPT3_remark,
					vare_DPT4_date,vare_DPT4_position,vare_DPT4_batch_num,vare_DPT4_doctor,vare_DPT4_remark,
					vare_white_broken_vaccine_date,vare_white_broken_vaccine_position,vare_white_broken_vaccine_batch_num,
					vare_white_broken_vaccine_doctor,vare_white_broken_vaccine_remark,
					vare_leprosy_vaccine_date,vare_leprosy_vaccine_position,vare_leprosy_vaccine_batch_num,
					vare_leprosy_vaccine_doctor,vare_leprosy_vaccine_remark,
					vare_MMR_vaccine1_date,vare_MMR_vaccine1_position,vare_MMR_vaccine1_batch_num,vare_MMR_vaccine1_doctor,vare_MMR_vaccine1_remark,
					vare_MMR_vaccine2_date,vare_MMR_vaccine2_position,vare_MMR_vaccine2_batch_num,vare_MMR_vaccine2_doctor,vare_MMR_vaccine2_remark,
					vare_MMR_vaccine_date,vare_MMR_vaccine_position,vare_MMR_vaccine_batch_num,vare_MMR_vaccine_doctor,vare_MMR_vaccine_remark,
					vare_measles_vaccine1_date,vare_measles_vaccine1_position,vare_measles_vaccine1_batch_num,
					vare_measles_vaccine1_doctor,vare_measles_vaccine1_remark,
					vare_measles_vaccine2_date,vare_measles_vaccine2_position,vare_measles_vaccine2_batch_num,
					vare_measles_vaccine2_doctor,vare_measles_vaccine2_remark;
	private Button vare_hepatitis_b_vaccine; 
					
	View v;
	Paint paint;
	private LinearLayout ll;
	private int profile_id=0;
	private Context myContext;
	VaccinationRecord vr;
	MyPopupWindow mPopupWindow;
//	VaccinationCard vc;
	HereTipa ht;
	public VaccinationRecordView(Context context,int pro) {
		super(context);
		this.myContext=context;
		profile_id=pro;
		// TODO Auto-generated constructor stub
		paint=new Paint();
		paint.setStyle(Paint.Style.FILL_AND_STROKE);
		paint.setTypeface(Typeface.DEFAULT_BOLD);
		paint.setColor(Color.BLACK);
		
	}
	public void addToView(){
		
		
		LayoutParams lp=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
		this.addView(v,lp);
		MyView mv=new MyView(myContext);
		this.addView(mv,lp);
	}
	class MyView extends View{
		 View v;
		 Paint paint;
		 public MyView(Context context){
			 super(context);
			 paint=new Paint();
			 paint.setStyle(Paint.Style.FILL_AND_STROKE);
			 paint.setTypeface(Typeface.DEFAULT_BOLD);
			 paint.setColor(Color.BLACK);
			
		 }
		 public void onDraw(Canvas c){
			 int top=ll.getTop();
			 int left=ll.getLeft()+30;
			 int right=ll.getRight()+30;
			 int y=0;
			 top=top-y;
			 c.drawLine(left, top, right, top, paint);
			 c.drawLine(left, top+50, right, top+50, paint);
			 c.drawLine(left+120, top+100, right, top+100, paint);
			 c.drawLine(left+120, top+150, right, top+150, paint);
			 c.drawLine(left, top+200, right, top+200, paint);
			 c.drawLine(left, top+250, right, top+250, paint);
			 c.drawLine(left+120, top+300, right, top+300, paint);
			 c.drawLine(left+120, top+350, right, top+350, paint);
			 c.drawLine(left+120, top+400, right, top+400, paint);
			 c.drawLine(left, top+450, right, top+450, paint);
			 c.drawLine(left+120, top+500, right, top+500, paint);
			 c.drawLine(left+120, top+550, right, top+550, paint);
			 c.drawLine(left+120, top+600, right, top+600, paint);
			 c.drawLine(left, top+650, right, top+650, paint);
			 c.drawLine(left, top+700, right, top+700, paint);
			 c.drawLine(left, top+750, right, top+750, paint);
			 c.drawLine(left+120, top+800, right, top+800, paint);
			 c.drawLine(left, top+850, right, top+850, paint);
			 c.drawLine(left, top+900, right, top+900, paint);
			 c.drawLine(left+120, top+950, right, top+950, paint);
			 c.drawLine(left, top+1000, right, top+1000, paint);
			 
			 
			 
			 
			 c.drawLine(left, top, left, top+1000, paint);
			 c.drawLine(right, top, right, top+1000, paint);
			 c.drawLine(left+180, top, left+180, top+1000, paint);
			 c.drawLine(left+300, top, left+300, top+1000, paint);
			 c.drawLine(left+400, top, left+400, top+1000, paint);
			 c.drawLine(left+500, top, left+500, top+1000, paint);
			 c.drawLine(left+600, top, left+600, top+1000, paint);
			 c.drawLine(left+120, top+50, left+120, top+200, paint);
			 c.drawLine(left+120, top+250, left+120, top+650, paint);
			 c.drawLine(left+120, top+750, left+120, top+850, paint);
			 c.drawLine(left+120, top+900, left+120, top+1000, paint);
			 
		 }
	}
	public void findWidget(){
		LayoutInflater factory=LayoutInflater.from(myContext);
		v=factory.inflate(R.layout.vaccination_record, null);
		ll=(LinearLayout)v.findViewById(R.id.fam_eco_hushuxing);
		et_vare_name=(EditText)v.findViewById(R.id.et_vare_name);
		et_vare_profile_id=(EditText)v.findViewById(R.id.et_vare_profile_id);
		vare_hepatitis_b_vaccine1_date=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine1_date);
		vare_hepatitis_b_vaccine1_date.setInputType(InputType.TYPE_NULL);
		vare_hepatitis_b_vaccine1_date.setOnClickListener(this);
		vare_hepatitis_b_vaccine1_date.setOnFocusChangeListener(this);
		vare_hepatitis_b_vaccine1_position=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine1_position);
		vare_hepatitis_b_vaccine1_batch_num=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine1_batch_num);
		vare_hepatitis_b_vaccine1_doctor=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine1_doctor);
		vare_hepatitis_b_vaccine1_remark=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine1_remark);
		vare_hepatitis_b_vaccine2_date=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine2_date);
		vare_hepatitis_b_vaccine2_date.setInputType(InputType.TYPE_NULL);
		vare_hepatitis_b_vaccine2_date.setOnClickListener(this);
		vare_hepatitis_b_vaccine2_date.setOnFocusChangeListener(this);
		vare_hepatitis_b_vaccine2_position=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine2_position);
		vare_hepatitis_b_vaccine2_batch_num=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine2_batch_num);
		vare_hepatitis_b_vaccine2_doctor=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine2_doctor);
		vare_hepatitis_b_vaccine2_remark=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine2_remark);
		vare_hepatitis_b_vaccine3_date=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine3_date);
		vare_hepatitis_b_vaccine3_date.setInputType(InputType.TYPE_NULL);
		vare_hepatitis_b_vaccine3_date.setOnClickListener(this);
		vare_hepatitis_b_vaccine3_date.setOnFocusChangeListener(this);
		vare_hepatitis_b_vaccine3_position=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine3_position);
		vare_hepatitis_b_vaccine3_batch_num=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine3_batch_num);
		vare_hepatitis_b_vaccine3_doctor=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine3_doctor);
		vare_hepatitis_b_vaccine3_remark=(EditText)v.findViewById(R.id.vare_hepatitis_b_vaccine3_remark);
		vare_BCG_vaccine_date=(EditText)v.findViewById(R.id.vare_BCG_vaccine_date);
		vare_BCG_vaccine_date.setInputType(InputType.TYPE_NULL);
		vare_BCG_vaccine_date.setOnClickListener(this);
		vare_BCG_vaccine_date.setOnFocusChangeListener(this);
		vare_BCG_vaccine_position=(EditText)v.findViewById(R.id.vare_BCG_vaccine_position);
		vare_BCG_vaccine_batch_num=(EditText)v.findViewById(R.id.vare_BCG_vaccine_batch_num);
		vare_BCG_vaccine_doctor=(EditText)v.findViewById(R.id.vare_BCG_vaccine_doctor);
		vare_BCG_vaccine_remark=(EditText)v.findViewById(R.id.vare_BCG_vaccine_remark);
		vare_poliomyelitis_vaccine1_date=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine1_date);
		vare_poliomyelitis_vaccine1_date.setInputType(InputType.TYPE_NULL);
		vare_poliomyelitis_vaccine1_date.setOnClickListener(this);
		vare_poliomyelitis_vaccine1_date.setOnFocusChangeListener(this);
		vare_poliomyelitis_vaccine1_position=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine1_position);
		vare_poliomyelitis_vaccine1_batch_num=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine1_batch_num);
		vare_poliomyelitis_vaccine1_doctor=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine1_doctor);
		vare_poliomyelitis_vaccine1_remark=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine1_remark);
		vare_poliomyelitis_vaccine2_date=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine2_date);
		vare_poliomyelitis_vaccine2_date.setInputType(InputType.TYPE_NULL);
		vare_poliomyelitis_vaccine2_date.setOnClickListener(this);
		vare_poliomyelitis_vaccine2_date.setOnFocusChangeListener(this);
		vare_poliomyelitis_vaccine2_position=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine2_position);
		vare_poliomyelitis_vaccine2_batch_num=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine2_batch_num);
		vare_poliomyelitis_vaccine2_doctor=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine2_doctor);
		vare_poliomyelitis_vaccine2_remark=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine2_remark);
		vare_poliomyelitis_vaccine3_date=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine3_date);
		vare_poliomyelitis_vaccine3_date.setInputType(InputType.TYPE_NULL);
		vare_poliomyelitis_vaccine3_date.setOnClickListener(this);
		vare_poliomyelitis_vaccine3_date.setOnFocusChangeListener(this);
		vare_poliomyelitis_vaccine3_position=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine3_position);
		vare_poliomyelitis_vaccine3_batch_num=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine3_batch_num);
		vare_poliomyelitis_vaccine3_doctor=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine3_doctor);
		vare_poliomyelitis_vaccine3_remark=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine3_remark);
		vare_poliomyelitis_vaccine4_date=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine4_date);
		vare_poliomyelitis_vaccine4_date.setInputType(InputType.TYPE_NULL);
		vare_poliomyelitis_vaccine4_date.setOnClickListener(this);
		vare_poliomyelitis_vaccine3_date.setOnFocusChangeListener(this);
		vare_poliomyelitis_vaccine4_position=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine4_position);
		vare_poliomyelitis_vaccine4_batch_num=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine4_batch_num);
		vare_poliomyelitis_vaccine4_doctor=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine4_doctor);
		vare_poliomyelitis_vaccine4_remark=(EditText)v.findViewById(R.id.vare_poliomyelitis_vaccine4_remark);
		vare_DPT1_date=(EditText)v.findViewById(R.id.vare_DPT1_date);
		vare_DPT1_date.setInputType(InputType.TYPE_NULL);
		vare_DPT1_date.setOnClickListener(this);
		vare_DPT1_date.setOnFocusChangeListener(this);
		vare_DPT1_position=(EditText)v.findViewById(R.id.vare_DPT1_position);
		vare_DPT1_batch_num=(EditText)v.findViewById(R.id.vare_DPT1_batch_num);
		vare_DPT1_doctor=(EditText)v.findViewById(R.id.vare_DPT1_doctor);
		vare_DPT1_remark=(EditText)v.findViewById(R.id.vare_DPT1_remark);
		vare_DPT2_date=(EditText)v.findViewById(R.id.vare_DPT2_date);
		vare_DPT2_date.setInputType(InputType.TYPE_NULL);
		vare_DPT2_date.setOnClickListener(this);
		vare_DPT2_date.setOnFocusChangeListener(this);
		vare_DPT2_position=(EditText)v.findViewById(R.id.vare_DPT2_position);
		vare_DPT2_batch_num=(EditText)v.findViewById(R.id.vare_DPT2_batch_num);
		vare_DPT2_doctor=(EditText)v.findViewById(R.id.vare_DPT2_doctor);
		vare_DPT2_remark=(EditText)v.findViewById(R.id.vare_DPT2_remark);
		vare_DPT3_date=(EditText)v.findViewById(R.id.vare_DPT3_date);
		vare_DPT3_date.setInputType(InputType.TYPE_NULL);
		vare_DPT3_date.setOnClickListener(this);
		vare_DPT3_date.setOnFocusChangeListener(this);
		vare_DPT3_position=(EditText)v.findViewById(R.id.vare_DPT3_position);
		vare_DPT3_batch_num=(EditText)v.findViewById(R.id.vare_DPT3_batch_num);
		vare_DPT3_doctor=(EditText)v.findViewById(R.id.vare_DPT3_doctor);
		vare_DPT3_remark=(EditText)v.findViewById(R.id.vare_DPT3_remark);
		vare_DPT4_date=(EditText)v.findViewById(R.id.vare_DPT4_date);
		vare_DPT4_date.setInputType(InputType.TYPE_NULL);
		vare_DPT4_date.setOnClickListener(this);
		vare_DPT4_date.setOnFocusChangeListener(this);
		vare_DPT4_position=(EditText)v.findViewById(R.id.vare_DPT4_position);
		vare_DPT4_batch_num=(EditText)v.findViewById(R.id.vare_DPT4_batch_num);
		vare_DPT4_doctor=(EditText)v.findViewById(R.id.vare_DPT4_doctor);
		vare_DPT4_remark=(EditText)v.findViewById(R.id.vare_DPT4_remark);
		vare_white_broken_vaccine_date=(EditText)v.findViewById(R.id.vare_white_broken_vaccine_date);
		vare_white_broken_vaccine_date.setInputType(InputType.TYPE_NULL);
		vare_white_broken_vaccine_date.setOnClickListener(this);
		vare_white_broken_vaccine_date.setOnFocusChangeListener(this);
		vare_white_broken_vaccine_position=(EditText)v.findViewById(R.id.vare_white_broken_vaccine_position);
		vare_white_broken_vaccine_batch_num=(EditText)v.findViewById(R.id.vare_white_broken_vaccine_batch_num);
		vare_white_broken_vaccine_doctor=(EditText)v.findViewById(R.id.vare_white_broken_vaccine_doctor);
		vare_white_broken_vaccine_remark=(EditText)v.findViewById(R.id.vare_white_broken_vaccine_remark);
		vare_leprosy_vaccine_date=(EditText)v.findViewById(R.id.vare_leprosy_vaccine_date);
		vare_leprosy_vaccine_date.setInputType(InputType.TYPE_NULL);
		vare_leprosy_vaccine_date.setOnClickListener(this);
		vare_leprosy_vaccine_date.setOnFocusChangeListener(this);
		vare_leprosy_vaccine_position=(EditText)v.findViewById(R.id.vare_leprosy_vaccine_position);
		vare_leprosy_vaccine_batch_num=(EditText)v.findViewById(R.id.vare_leprosy_vaccine_batch_num);
		vare_leprosy_vaccine_doctor=(EditText)v.findViewById(R.id.vare_leprosy_vaccine_doctor);
		vare_leprosy_vaccine_remark=(EditText)v.findViewById(R.id.vare_leprosy_vaccine_remark);
		vare_MMR_vaccine1_date=(EditText)v.findViewById(R.id.vare_MMR_vaccine1_date);
		vare_MMR_vaccine1_date.setInputType(InputType.TYPE_NULL);
		vare_MMR_vaccine1_date.setOnClickListener(this);
		vare_MMR_vaccine1_date.setOnFocusChangeListener(this);
		vare_MMR_vaccine1_position=(EditText)v.findViewById(R.id.vare_MMR_vaccine1_position);
		vare_MMR_vaccine1_batch_num=(EditText)v.findViewById(R.id.vare_MMR_vaccine1_batch_num);
		vare_MMR_vaccine1_doctor=(EditText)v.findViewById(R.id.vare_MMR_vaccine1_doctor);
		vare_MMR_vaccine1_remark=(EditText)v.findViewById(R.id.vare_MMR_vaccine1_remark);
		vare_MMR_vaccine2_date=(EditText)v.findViewById(R.id.vare_MMR_vaccine2_date);
		vare_MMR_vaccine2_date.setInputType(InputType.TYPE_NULL);
		vare_MMR_vaccine2_date.setOnClickListener(this);
		vare_MMR_vaccine2_date.setOnFocusChangeListener(this);
		vare_MMR_vaccine2_position=(EditText)v.findViewById(R.id.vare_MMR_vaccine2_position);
		vare_MMR_vaccine2_batch_num=(EditText)v.findViewById(R.id.vare_MMR_vaccine2_batch_num);
		vare_MMR_vaccine2_doctor=(EditText)v.findViewById(R.id.vare_MMR_vaccine2_doctor);
		vare_MMR_vaccine2_remark=(EditText)v.findViewById(R.id.vare_MMR_vaccine2_remark);
		vare_MMR_vaccine_date=(EditText)v.findViewById(R.id.vare_MMR_vaccine_date);
		vare_MMR_vaccine_date.setInputType(InputType.TYPE_NULL);
		vare_MMR_vaccine_date.setOnClickListener(this);
		vare_MMR_vaccine_date.setOnFocusChangeListener(this);
		vare_MMR_vaccine_position=(EditText)v.findViewById(R.id.vare_MMR_vaccine_position);
		vare_MMR_vaccine_batch_num=(EditText)v.findViewById(R.id.vare_MMR_vaccine_batch_num);
		vare_MMR_vaccine_doctor=(EditText)v.findViewById(R.id.vare_MMR_vaccine_doctor);
		vare_MMR_vaccine_remark=(EditText)v.findViewById(R.id.vare_MMR_vaccine_remark);
		vare_measles_vaccine1_date=(EditText)v.findViewById(R.id.vare_measles_vaccine1_date);
		vare_measles_vaccine1_date.setInputType(InputType.TYPE_NULL);
		vare_measles_vaccine1_date.setOnClickListener(this);
		vare_measles_vaccine1_date.setOnFocusChangeListener(this);
		vare_measles_vaccine1_position=(EditText)v.findViewById(R.id.vare_measles_vaccine1_position);
		vare_measles_vaccine1_batch_num=(EditText)v.findViewById(R.id.vare_measles_vaccine1_batch_num);
		vare_measles_vaccine1_doctor=(EditText)v.findViewById(R.id.vare_measles_vaccine1_doctor);
		vare_measles_vaccine1_remark=(EditText)v.findViewById(R.id.vare_measles_vaccine1_remark);
		vare_measles_vaccine2_date=(EditText)v.findViewById(R.id.vare_measles_vaccine2_date);
		vare_measles_vaccine2_date.setInputType(InputType.TYPE_NULL);
		vare_measles_vaccine2_date.setOnClickListener(this);
		vare_measles_vaccine2_date.setOnFocusChangeListener(this);
		vare_measles_vaccine2_position=(EditText)v.findViewById(R.id.vare_measles_vaccine2_position);
		vare_measles_vaccine2_batch_num=(EditText)v.findViewById(R.id.vare_measles_vaccine2_batch_num);
		vare_measles_vaccine2_doctor=(EditText)v.findViewById(R.id.vare_measles_vaccine2_doctor);
		vare_measles_vaccine2_remark=(EditText)v.findViewById(R.id.vare_measles_vaccine2_remark);
		vare_hepatitis_b_vaccine=(Button)v.findViewById(R.id.vare_hepatitis_b_vaccine);
		vare_hepatitis_b_vaccine.setOnClickListener(this);
	//	vc=new VaccinationCard(myContext);
	//	vc.selectCode(profile_id);
		ht=new HereTipa(myContext);
		ht.selectNameAndCode(profile_id);
		vr=new VaccinationRecord(myContext);
		vr.selectVaccinationRecord(profile_id);
	}
	public void selectData(){
	//	 vc.selectCode(profile_id);
		 ht.selectNameAndCode(profile_id);
		 vr.selectVaccinationRecord(profile_id);
		 
	}
	public void initVaccinationRecordView(){
		if(ht.getHeti_name()!=null){
			et_vare_name.setText(ht.getHeti_name());
		}
		if(ht.getHeti_here_id()!=null){
			et_vare_profile_id.setText(ht.getHeti_here_id());
		}
		
		if(vr.getVare_hepatitis_b_vaccine1()!=null&&vr.getVare_hepatitis_b_vaccine1().length()>0){
			String []arrhepatitis_b_vaccine1=vr.getVare_hepatitis_b_vaccine1().split(",");
			if(arrhepatitis_b_vaccine1.length>0){
				for(int i=0;i<arrhepatitis_b_vaccine1.length;i++){
				    if(i==0)vare_hepatitis_b_vaccine1_date.setText(arrhepatitis_b_vaccine1[i]);
					if(i==1)vare_hepatitis_b_vaccine1_position.setText(arrhepatitis_b_vaccine1[i]);
					if(i==2)vare_hepatitis_b_vaccine1_batch_num.setText(arrhepatitis_b_vaccine1[i]);
					if(i==3)vare_hepatitis_b_vaccine1_doctor.setText(arrhepatitis_b_vaccine1[i]);
					if(i==4)vare_hepatitis_b_vaccine1_remark.setText(arrhepatitis_b_vaccine1[i]);
				}	
			}
		}
		if(vr.getVare_hepatitis_b_vaccine2()!=null&&vr.getVare_hepatitis_b_vaccine2().length()>0){
			String []arrhepatitis_b_vaccine2=vr.getVare_hepatitis_b_vaccine2().split(",");
			if(arrhepatitis_b_vaccine2.length>0){
				for(int i=0;i<arrhepatitis_b_vaccine2.length;i++){
					if(i==0)vare_hepatitis_b_vaccine2_date.setText(arrhepatitis_b_vaccine2[i]);
					if(i==1)vare_hepatitis_b_vaccine2_position.setText(arrhepatitis_b_vaccine2[i]);
					if(i==2)vare_hepatitis_b_vaccine2_batch_num.setText(arrhepatitis_b_vaccine2[i]);
					if(i==3)vare_hepatitis_b_vaccine2_doctor.setText(arrhepatitis_b_vaccine2[i]);
					if(i==4)vare_hepatitis_b_vaccine2_remark.setText(arrhepatitis_b_vaccine2[i]);
				}
			}
		}
		if(vr.getVare_hepatitis_b_vaccine3()!=null&&vr.getVare_hepatitis_b_vaccine3().length()>0){
			String []arrhepatitis_b_vaccine3=vr.getVare_hepatitis_b_vaccine3().split(",");
			if(arrhepatitis_b_vaccine3.length>0){
				for(int i=0;i<arrhepatitis_b_vaccine3.length;i++){
					if(i==0)vare_hepatitis_b_vaccine3_date.setText(arrhepatitis_b_vaccine3[i]);
					if(i==1)vare_hepatitis_b_vaccine3_position.setText(arrhepatitis_b_vaccine3[i]);
					if(i==2)vare_hepatitis_b_vaccine3_batch_num.setText(arrhepatitis_b_vaccine3[i]);
					if(i==3)vare_hepatitis_b_vaccine3_doctor.setText(arrhepatitis_b_vaccine3[i]);
					if(i==4)vare_hepatitis_b_vaccine3_remark.setText(arrhepatitis_b_vaccine3[i]);
				}	
			}
		}
		if(vr.getVare_BCG_vaccine()!=null&&vr.getVare_BCG_vaccine().length()>0){
			String []arrBCG_vaccine=vr.getVare_BCG_vaccine().split(",");
			if(arrBCG_vaccine.length>0){
				for(int i=0;i<arrBCG_vaccine.length;i++){
					if(i==0)vare_BCG_vaccine_date.setText(arrBCG_vaccine[i]);
					if(i==1)vare_BCG_vaccine_position.setText(arrBCG_vaccine[i]);
					if(i==2)vare_BCG_vaccine_batch_num.setText(arrBCG_vaccine[i]);
					if(i==3)vare_BCG_vaccine_doctor.setText(arrBCG_vaccine[i]);
					if(i==4)vare_BCG_vaccine_remark.setText(arrBCG_vaccine[i]);
				}
			}
		}
		if(vr.getVare_poliomyelitis_vaccine1()!=null&&vr.getVare_poliomyelitis_vaccine1().length()>0){
			String []arrpoliomyelitis_vaccine1=vr.getVare_poliomyelitis_vaccine1().split(",");
			if(arrpoliomyelitis_vaccine1.length>0){
				for(int i=0;i<arrpoliomyelitis_vaccine1.length;i++){
					if(i==0)vare_poliomyelitis_vaccine1_date.setText(arrpoliomyelitis_vaccine1[i]);
					if(i==1)vare_poliomyelitis_vaccine1_position.setText(arrpoliomyelitis_vaccine1[i]);
					if(i==2)vare_poliomyelitis_vaccine1_batch_num.setText(arrpoliomyelitis_vaccine1[i]);
					if(i==3)vare_poliomyelitis_vaccine1_doctor.setText(arrpoliomyelitis_vaccine1[i]);
					if(i==4)vare_poliomyelitis_vaccine1_remark.setText(arrpoliomyelitis_vaccine1[i]);
				}
			}
		}
		if(vr.getVare_poliomyelitis_vaccine2()!=null&&vr.getVare_poliomyelitis_vaccine2().length()>0){
			String []arrpoliomyelitis_vaccine2=vr.getVare_poliomyelitis_vaccine2().split(",");
			if(arrpoliomyelitis_vaccine2.length>0){
				for(int i=0;i<arrpoliomyelitis_vaccine2.length;i++){
					if(i==0)vare_poliomyelitis_vaccine2_date.setText(arrpoliomyelitis_vaccine2[i]);
					if(i==1)vare_poliomyelitis_vaccine2_position.setText(arrpoliomyelitis_vaccine2[i]);
					if(i==2)vare_poliomyelitis_vaccine2_batch_num.setText(arrpoliomyelitis_vaccine2[i]);
					if(i==3)vare_poliomyelitis_vaccine2_doctor.setText(arrpoliomyelitis_vaccine2[i]);
					if(i==4)vare_poliomyelitis_vaccine2_remark.setText(arrpoliomyelitis_vaccine2[i]);
				}
			}
		}
		if(vr.getVare_poliomyelitis_vaccine3()!=null&&vr.getVare_poliomyelitis_vaccine3().length()>0){
			String []arrpoliomyelitis_vaccine3=vr.getVare_poliomyelitis_vaccine3().split(",");
			if(arrpoliomyelitis_vaccine3.length>0){
				for(int i=0;i<arrpoliomyelitis_vaccine3.length;i++){
					if(i==0)vare_poliomyelitis_vaccine3_date.setText(arrpoliomyelitis_vaccine3[i]);
					if(i==1)vare_poliomyelitis_vaccine3_position.setText(arrpoliomyelitis_vaccine3[i]);
					if(i==2)vare_poliomyelitis_vaccine3_batch_num.setText(arrpoliomyelitis_vaccine3[i]);
					if(i==3)vare_poliomyelitis_vaccine3_doctor.setText(arrpoliomyelitis_vaccine3[i]);
					if(i==4)vare_poliomyelitis_vaccine3_remark.setText(arrpoliomyelitis_vaccine3[i]);
				}
			}
		}
		if(vr.getVare_poliomyelitis_vaccine4()!=null&&vr.getVare_poliomyelitis_vaccine4().length()>0){
			String []arrpoliomyelitis_vaccine4=vr.getVare_poliomyelitis_vaccine4().split(",");
			if(arrpoliomyelitis_vaccine4.length>0){
				for(int i=0;i<arrpoliomyelitis_vaccine4.length;i++){
					if(i==0)vare_poliomyelitis_vaccine4_date.setText(arrpoliomyelitis_vaccine4[i]);
					if(i==1)vare_poliomyelitis_vaccine4_position.setText(arrpoliomyelitis_vaccine4[i]);
					if(i==2)vare_poliomyelitis_vaccine4_batch_num.setText(arrpoliomyelitis_vaccine4[i]);
					if(i==3)vare_poliomyelitis_vaccine4_doctor.setText(arrpoliomyelitis_vaccine4[i]);
					if(i==4)vare_poliomyelitis_vaccine4_remark.setText(arrpoliomyelitis_vaccine4[i]);
				}
			}
		}
		if(vr.getVare_DPT1()!=null&&vr.getVare_DPT1().length()>0){
			String []arrDPT1=vr.getVare_DPT1().split(",");
			if(arrDPT1.length>0){
				for(int i=0;i<arrDPT1.length;i++){
					if(i==0)vare_DPT1_date.setText(arrDPT1[i]);
					if(i==1)vare_DPT1_position.setText(arrDPT1[i]);
					if(i==2)vare_DPT1_batch_num.setText(arrDPT1[i]);
					if(i==3)vare_DPT1_doctor.setText(arrDPT1[i]);
					if(i==4)vare_DPT1_remark.setText(arrDPT1[i]);
				}
			}
		}
		if(vr.getVare_DPT2()!=null&&vr.getVare_DPT2().length()>0){
			String []arrDPT2=vr.getVare_DPT2().split(",");
			if(arrDPT2.length>0){
				for(int i=0;i<arrDPT2.length;i++){
					if(i==0)vare_DPT2_date.setText(arrDPT2[i]);
					if(i==1)vare_DPT2_position.setText(arrDPT2[i]);
					if(i==2)vare_DPT2_batch_num.setText(arrDPT2[i]);
					if(i==3)vare_DPT2_doctor.setText(arrDPT2[i]);
					if(i==4)vare_DPT2_remark.setText(arrDPT2[i]);
				}
			}
		}
		if(vr.getVare_DPT3()!=null&&vr.getVare_DPT3().length()>0){
			String []arrDPT3=vr.getVare_DPT3().split(",");
			if(arrDPT3.length>0){
				for(int i=0;i<arrDPT3.length;i++){
					if(i==0)vare_DPT3_date.setText(arrDPT3[i]);
					if(i==1)vare_DPT3_position.setText(arrDPT3[i]);
					if(i==2)vare_DPT3_batch_num.setText(arrDPT3[i]);
					if(i==3)vare_DPT3_doctor.setText(arrDPT3[i]);
					if(i==4)vare_DPT3_remark.setText(arrDPT3[i]);
				}
			}
		}
		if(vr.getVare_DPT4()!=null&&vr.getVare_DPT4().length()>0){
			String []arrDPT4=vr.getVare_DPT4().split(",");
			if(arrDPT4.length>0){
				for(int i=0;i<arrDPT4.length;i++){
					if(i==0)vare_DPT4_date.setText(arrDPT4[i]);
					if(i==1)vare_DPT4_position.setText(arrDPT4[i]);
					if(i==2)vare_DPT4_batch_num.setText(arrDPT4[i]);
					if(i==3)vare_DPT4_doctor.setText(arrDPT4[i]);
					if(i==4)vare_DPT4_remark.setText(arrDPT4[i]);
				}
			}
		}
		if(vr.getVare_white_broken_vaccine()!=null&&vr.getVare_white_broken_vaccine().length()>0){
			String []arrwhite_broken_vaccine=vr.getVare_white_broken_vaccine().split(",");
			if(arrwhite_broken_vaccine.length>0){
				for(int i=0;i<arrwhite_broken_vaccine.length;i++){
					if(i==0)vare_white_broken_vaccine_date.setText(arrwhite_broken_vaccine[i]);
					if(i==1)vare_white_broken_vaccine_position.setText(arrwhite_broken_vaccine[i]);
					if(i==2)vare_white_broken_vaccine_batch_num.setText(arrwhite_broken_vaccine[i]);
					if(i==3)vare_white_broken_vaccine_doctor.setText(arrwhite_broken_vaccine[i]);
					if(i==4)vare_white_broken_vaccine_remark.setText(arrwhite_broken_vaccine[i]);
				}
			}
		}	
		if(vr.getVare_leprosy_vaccine()!=null&&vr.getVare_leprosy_vaccine().length()>0){
			String []arrleprosy_vaccine=vr.getVare_leprosy_vaccine().split(",");
			if(arrleprosy_vaccine.length>0){
				for(int i=0;i<arrleprosy_vaccine.length;i++){
					if(i==0)vare_leprosy_vaccine_date.setText(arrleprosy_vaccine[i]);
					if(i==1)vare_leprosy_vaccine_position.setText(arrleprosy_vaccine[i]);
					if(i==2)vare_leprosy_vaccine_batch_num.setText(arrleprosy_vaccine[i]);
					if(i==3)vare_leprosy_vaccine_doctor.setText(arrleprosy_vaccine[i]);
					if(i==4)vare_leprosy_vaccine_remark.setText(arrleprosy_vaccine[i]);
				}
			}
		}
		if(vr.getVare_MMR_vaccine1()!=null&&vr.getVare_MMR_vaccine1().length()>0){
			String []arrMMR_vaccine1=vr.getVare_MMR_vaccine1().split(",");
			if(arrMMR_vaccine1.length>0){
				for(int i=0;i<arrMMR_vaccine1.length;i++){
					if(i==0)vare_MMR_vaccine1_date.setText(arrMMR_vaccine1[i]);
					if(i==1)vare_MMR_vaccine1_position.setText(arrMMR_vaccine1[i]);
					if(i==2)vare_MMR_vaccine1_batch_num.setText(arrMMR_vaccine1[i]);
					if(i==3)vare_MMR_vaccine1_doctor.setText(arrMMR_vaccine1[i]);
					if(i==4)vare_MMR_vaccine1_remark.setText(arrMMR_vaccine1[i]);
				}
			}
		}
		if(vr.getVare_MMR_vaccine2()!=null&&vr.getVare_MMR_vaccine2().length()>0){
			String []arrMMR_vaccine2=vr.getVare_MMR_vaccine2().split(",");
			if(arrMMR_vaccine2.length>0){
				for(int i=0;i<arrMMR_vaccine2.length;i++){
					if(i==0)vare_MMR_vaccine2_date.setText(arrMMR_vaccine2[i]);
					if(i==1)vare_MMR_vaccine2_position.setText(arrMMR_vaccine2[i]);
					if(i==2)vare_MMR_vaccine2_batch_num.setText(arrMMR_vaccine2[i]);
					if(i==3)vare_MMR_vaccine2_doctor.setText(arrMMR_vaccine2[i]);
					if(i==4)vare_MMR_vaccine2_remark.setText(arrMMR_vaccine2[i]);
				}
			}
		}
		if(vr.getVare_MMR_vaccine()!=null&&vr.getVare_MMR_vaccine().length()>0){
			String []arrMMR_vaccine=vr.getVare_MMR_vaccine().split(",");
			if(arrMMR_vaccine.length>0){
				for(int i=0;i<arrMMR_vaccine.length;i++){
					if(i==0)vare_MMR_vaccine_date.setText(arrMMR_vaccine[i]);
					if(i==1)vare_MMR_vaccine_position.setText(arrMMR_vaccine[i]);
					if(i==2)vare_MMR_vaccine_batch_num.setText(arrMMR_vaccine[i]);
					if(i==3)vare_MMR_vaccine_doctor.setText(arrMMR_vaccine[i]);
					if(i==4)vare_MMR_vaccine_remark.setText(arrMMR_vaccine[i]);
				}
			}
		}
		if(vr.getVare_measles_vaccine1()!=null&&vr.getVare_measles_vaccine1().length()>0){
			String []arrmeasles_vaccine1=vr.getVare_measles_vaccine1().split(",");
			if(arrmeasles_vaccine1.length>0){
				for(int i=0;i<arrmeasles_vaccine1.length;i++){
					if(i==0)vare_measles_vaccine1_date.setText(arrmeasles_vaccine1[i]);
					if(i==1)vare_measles_vaccine1_position.setText(arrmeasles_vaccine1[i]);
					if(i==2)vare_measles_vaccine1_batch_num.setText(arrmeasles_vaccine1[i]);
					if(i==3)vare_measles_vaccine1_doctor.setText(arrmeasles_vaccine1[i]);
					if(i==4)vare_measles_vaccine1_remark.setText(arrmeasles_vaccine1[i]);
				}
			}
		}	
		if(vr.getVare_measles_vaccine2()!=null&&vr.getVare_measles_vaccine2().length()>0){
			String []arrmeasles_vaccine2=vr.getVare_measles_vaccine2().split(",");
			if(arrmeasles_vaccine2.length>0){
				for(int i=0;i<arrmeasles_vaccine2.length;i++){
					if(i==0)vare_measles_vaccine2_date.setText(arrmeasles_vaccine2[i]);
					if(i==1)vare_measles_vaccine2_position.setText(arrmeasles_vaccine2[i]);
					if(i==2)vare_measles_vaccine2_batch_num.setText(arrmeasles_vaccine2[i]);
					if(i==3)vare_measles_vaccine2_doctor.setText(arrmeasles_vaccine2[i]);
					if(i==4)vare_measles_vaccine2_remark.setText(arrmeasles_vaccine2[i]);
				}
			}
		}		
	}
	public boolean saveVaccinationRecordView(){
		VaccinationRecord vr=new VaccinationRecord(myContext);
		vr.selectVaccinationRecord(profile_id);
		vr.setVare_hepatitis_b_vaccine1(vare_hepatitis_b_vaccine1_date.getText().toString()+","+
				vare_hepatitis_b_vaccine1_position.getText().toString()+","+
				vare_hepatitis_b_vaccine1_batch_num.getText().toString()+","+
				vare_hepatitis_b_vaccine1_doctor.getText().toString()+","+
				vare_hepatitis_b_vaccine1_remark.getText().toString());
		vr.setVare_hepatitis_b_vaccine2(vare_hepatitis_b_vaccine2_date.getText().toString()+","+
				vare_hepatitis_b_vaccine2_position.getText().toString()+","+
				vare_hepatitis_b_vaccine2_batch_num.getText().toString()+","+
				vare_hepatitis_b_vaccine2_doctor.getText().toString()+","+
				vare_hepatitis_b_vaccine2_remark.getText().toString());
		vr.setVare_hepatitis_b_vaccine3(vare_hepatitis_b_vaccine3_date.getText().toString()+","+
				vare_hepatitis_b_vaccine3_position.getText().toString()+","+
				vare_hepatitis_b_vaccine3_batch_num.getText().toString()+","+
				vare_hepatitis_b_vaccine3_doctor.getText().toString()+","+
				vare_hepatitis_b_vaccine3_remark.getText().toString());
		vr.setVare_BCG_vaccine(vare_BCG_vaccine_date.getText().toString()+","+
				vare_BCG_vaccine_position.getText().toString()+","+
				vare_BCG_vaccine_batch_num.getText().toString()+","+
				vare_BCG_vaccine_doctor.getText().toString()+","+
				vare_BCG_vaccine_remark.getText().toString());
		vr.setVare_poliomyelitis_vaccine1(vare_poliomyelitis_vaccine1_date.getText().toString()+","+
				vare_poliomyelitis_vaccine1_position.getText().toString()+","+
				vare_poliomyelitis_vaccine1_batch_num.getText().toString()+","+
				vare_poliomyelitis_vaccine1_doctor.getText().toString()+","+
				vare_poliomyelitis_vaccine1_remark.getText().toString());
		vr.setVare_poliomyelitis_vaccine2(vare_poliomyelitis_vaccine2_date.getText().toString()+","+
				vare_poliomyelitis_vaccine2_position.getText().toString()+","+
				vare_poliomyelitis_vaccine2_batch_num.getText().toString()+","+
				vare_poliomyelitis_vaccine2_doctor.getText().toString()+","+
				vare_poliomyelitis_vaccine2_remark.getText().toString());
		vr.setVare_poliomyelitis_vaccine3(vare_poliomyelitis_vaccine3_date.getText().toString()+","+
				vare_poliomyelitis_vaccine3_position.getText().toString()+","+
				vare_poliomyelitis_vaccine3_batch_num.getText().toString()+","+
				vare_poliomyelitis_vaccine3_doctor.getText().toString()+","+
				vare_poliomyelitis_vaccine3_remark.getText().toString());
		vr.setVare_poliomyelitis_vaccine4(vare_poliomyelitis_vaccine4_date.getText().toString()+","+
				vare_poliomyelitis_vaccine4_position.getText().toString()+","+
				vare_poliomyelitis_vaccine4_batch_num.getText().toString()+","+
				vare_poliomyelitis_vaccine4_doctor.getText().toString()+","+
				vare_poliomyelitis_vaccine4_remark.getText().toString());
		vr.setVare_DPT1(vare_DPT1_date.getText().toString()+","+
				vare_DPT1_position.getText().toString()+","+
				vare_DPT1_batch_num.getText().toString()+","+
				vare_DPT1_doctor.getText().toString()+","+
				vare_DPT1_remark.getText().toString());
		vr.setVare_DPT2(vare_DPT2_date.getText().toString()+","+
				vare_DPT2_position.getText().toString()+","+
				vare_DPT2_batch_num.getText().toString()+","+
				vare_DPT2_doctor.getText().toString()+","+
				vare_DPT2_remark.getText().toString());
		vr.setVare_DPT3(vare_DPT3_date.getText().toString()+","+
				vare_DPT3_position.getText().toString()+","+
				vare_DPT3_batch_num.getText().toString()+","+
				vare_DPT3_doctor.getText().toString()+","+
				vare_DPT3_remark.getText().toString());
		vr.setVare_DPT4(vare_DPT4_date.getText().toString()+","+
				vare_DPT4_position.getText().toString()+","+
				vare_DPT4_batch_num.getText().toString()+","+
				vare_DPT4_doctor.getText().toString()+","+
				vare_DPT4_remark.getText().toString());
		vr.setVare_white_broken_vaccine(vare_white_broken_vaccine_date.getText().toString()+","+
				vare_white_broken_vaccine_position.getText().toString()+","+
				vare_white_broken_vaccine_batch_num.getText().toString()+","+
				vare_white_broken_vaccine_doctor.getText().toString()+","+
				vare_white_broken_vaccine_remark.getText().toString());
		vr.setVare_leprosy_vaccine(vare_leprosy_vaccine_date.getText().toString()+","+
				vare_leprosy_vaccine_position.getText().toString()+","+
				vare_leprosy_vaccine_batch_num.getText().toString()+","+
				vare_leprosy_vaccine_doctor.getText().toString()+","+
				vare_leprosy_vaccine_remark.getText().toString());
		vr.setVare_MMR_vaccine1(vare_MMR_vaccine1_date.getText().toString()+","+
				vare_MMR_vaccine1_position.getText().toString()+","+
				vare_MMR_vaccine1_batch_num.getText().toString()+","+
				vare_MMR_vaccine1_doctor.getText().toString()+","+
				vare_MMR_vaccine1_remark.getText().toString());
		vr.setVare_MMR_vaccine2(vare_MMR_vaccine2_date.getText().toString()+","+
				vare_MMR_vaccine2_position.getText().toString()+","+
				vare_MMR_vaccine2_batch_num.getText().toString()+","+
				vare_MMR_vaccine2_doctor.getText().toString()+","+
				vare_MMR_vaccine2_remark.getText().toString());
		vr.setVare_MMR_vaccine(vare_MMR_vaccine_date.getText().toString()+","+
				vare_MMR_vaccine_position.getText().toString()+","+
				vare_MMR_vaccine_batch_num.getText().toString()+","+
				vare_MMR_vaccine_doctor.getText().toString()+","+
				vare_MMR_vaccine_remark.getText().toString());
		vr.setVare_measles_vaccine1(vare_measles_vaccine1_date.getText().toString()+","+
				vare_measles_vaccine1_position.getText().toString()+","+
				vare_measles_vaccine1_batch_num.getText().toString()+","+
				vare_measles_vaccine1_doctor.getText().toString()+","+
				vare_measles_vaccine1_remark.getText().toString());
		vr.setVare_measles_vaccine2(vare_measles_vaccine2_date.getText().toString()+","+
				vare_measles_vaccine2_position.getText().toString()+","+
				vare_measles_vaccine2_batch_num.getText().toString()+","+
				vare_measles_vaccine2_doctor.getText().toString()+","+
				vare_measles_vaccine2_remark.getText().toString());	
		vr.updateVaccinationRecord(profile_id);
		return true;
	}
	@Override
	
	
	
	
	
	public void onFocusChange(View v, boolean hasFocus) {
		// TODO Auto-generated method stub
		if(v==vare_hepatitis_b_vaccine1_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_hepatitis_b_vaccine1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_hepatitis_b_vaccine1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_hepatitis_b_vaccine2_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_hepatitis_b_vaccine2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_hepatitis_b_vaccine2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_hepatitis_b_vaccine3_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_hepatitis_b_vaccine3_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_hepatitis_b_vaccine3_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_BCG_vaccine_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_BCG_vaccine_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_BCG_vaccine_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_poliomyelitis_vaccine1_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_poliomyelitis_vaccine1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_poliomyelitis_vaccine1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_poliomyelitis_vaccine2_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_poliomyelitis_vaccine2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_poliomyelitis_vaccine2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_poliomyelitis_vaccine3_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_poliomyelitis_vaccine3_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_poliomyelitis_vaccine3_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_poliomyelitis_vaccine4_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_poliomyelitis_vaccine4_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_poliomyelitis_vaccine4_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_DPT1_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_DPT1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_DPT1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_DPT2_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_DPT2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_DPT2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_DPT3_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_DPT3_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_DPT3_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_DPT4_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_DPT4_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_DPT4_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_white_broken_vaccine_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_white_broken_vaccine_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_white_broken_vaccine_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_leprosy_vaccine_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_leprosy_vaccine_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_leprosy_vaccine_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_MMR_vaccine1_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_MMR_vaccine1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_MMR_vaccine1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_MMR_vaccine2_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_MMR_vaccine2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_MMR_vaccine2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_MMR_vaccine_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_MMR_vaccine_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_MMR_vaccine_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_measles_vaccine1_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_measles_vaccine1_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_measles_vaccine1_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_measles_vaccine2_date&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_measles_vaccine2_date), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_measles_vaccine2_date.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==vare_hepatitis_b_vaccine&&hasFocus){
			mPopupWindow = new MyPopupWindow(getContext());			
			mPopupWindow.showAtLocation(findViewById(R.id.vare_hepatitis_b_vaccine), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					vare_hepatitis_b_vaccine.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
    }
	
	
	
	
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v==vare_hepatitis_b_vaccine1_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_hepatitis_b_vaccine1_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_hepatitis_b_vaccine1_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_hepatitis_b_vaccine2_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_hepatitis_b_vaccine2_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_hepatitis_b_vaccine2_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_hepatitis_b_vaccine3_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_hepatitis_b_vaccine3_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_hepatitis_b_vaccine3_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_BCG_vaccine_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_BCG_vaccine_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_BCG_vaccine_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_poliomyelitis_vaccine1_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_poliomyelitis_vaccine1_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_poliomyelitis_vaccine1_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_poliomyelitis_vaccine2_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_poliomyelitis_vaccine2_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_poliomyelitis_vaccine2_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_poliomyelitis_vaccine3_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_poliomyelitis_vaccine3_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_poliomyelitis_vaccine3_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_poliomyelitis_vaccine4_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_poliomyelitis_vaccine4_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_poliomyelitis_vaccine4_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_DPT1_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_DPT1_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_DPT1_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_DPT2_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_DPT2_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_DPT2_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_DPT3_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_DPT3_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_DPT3_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_DPT4_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_DPT4_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_DPT4_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_DPT4_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_DPT4_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_DPT4_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_white_broken_vaccine_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_white_broken_vaccine_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_white_broken_vaccine_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_leprosy_vaccine_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_leprosy_vaccine_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_leprosy_vaccine_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_MMR_vaccine1_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_MMR_vaccine1_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_MMR_vaccine1_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_MMR_vaccine2_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_MMR_vaccine2_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_MMR_vaccine2_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_MMR_vaccine_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_MMR_vaccine_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_MMR_vaccine_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_measles_vaccine1_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_measles_vaccine1_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_measles_vaccine1_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_measles_vaccine2_date){
			 mPopupWindow = new MyPopupWindow(myContext);			
				mPopupWindow.showAtLocation(v.findViewById(R.id.vare_measles_vaccine2_date), Gravity.CENTER, 0, 0);

				Button btn=mPopupWindow.getButton();
				btn.setOnClickListener(new OnClickListener(){

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						vare_measles_vaccine2_date.setText(mPopupWindow.getDate());
						mPopupWindow.dismiss();
					}
					
				});
		}
		if(v==vare_hepatitis_b_vaccine){
			 LayoutInflater factory=LayoutInflater.from(myContext);  
			                 //得到自定义对话框  
			 final View DialogView=factory.inflate(R.layout.hepatitis_b_vaccine, null); 
			 new AlertDialog.Builder(myContext)
							.setIcon(R.drawable.alert_dialog_icon)
							.setTitle(R.string.vaccination_program)
							.setView(DialogView)
							.setPositiveButton("确定", new DialogInterface.OnClickListener() {
								public void onClick(DialogInterface dialog, int whichButton) {
                     
                 }
             }).create().show();
							
		}
		

		
	}

}
